// pages/willdo/willdo.js
var app=getApp();
Page({
  flodFn: function () {
    this.setData({
      isFold: !this.isFold
    });
  },
  /**
   * 页面的初始数据
   */
  data: {
    showView:true,
    shenpi:['同意','拒绝'],
    index:"0",
    array: [],
    bz:''
  },
  bindPickerChange: function (e) {
      this.setData({
      index: e.detail.value
    })
  },
  onChangeShowState: function () {
    let that=this;
    that.setData({
      showView: (!that.data.showView)
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    that.refresh();
    console.log(app.globalData)
  
  },
  refresh: function () {
    let that = this;
    wx.request({
      url: app.globalData.url + 'appletController.do?listdcl',
      data: {
        userid: app.globalData.userInfo
      },
      method: 'GET',
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        if (res.data.code == "1000") {
          console.log(res.data.data);
          that.setData({
            array: res.data.data
          })

        }
      }
    })
  },
 shRw: function(e) {
   let that=this;  
   console.log(e.currentTarget);
   let index = e.currentTarget.id;
   let currentData=that.data.array[index];   
   wx.request({
     url: app.globalData.url + 'appletController.do?shrw',
     data: {
       id: currentData.id,
       bz:that.data.bz,
       lx: currentData.lx,
       jg: that.data.index
     },
     method: 'GET',
     header: {
       'content-type': 'application/json'
     },
     success: function (res) {
       if (res.data.code == "1000") {
         that.refresh();
       }
     }
   })
   },
  bzInput: function (e) {
    this.setData({
      bz: e.detail.value
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})